package com.boom.search.repository;

import com.boom.search.domain.SearchDemo;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * created with IntelliJ IDEA.
 *
 * @author: yzw
 * @date: 2021/6/22 下午3:09
 * @description:
 */
@Repository
public interface SearchDemoRepository extends ElasticsearchRepository<SearchDemo, String> {

	/**
	 * 通过名称找到自定义
	 *
	 * @param keyword 关键字
	 * @return {@link List<SearchDemo> }
	 * @author yzw
	 * @date 2021-06-23
	 */
	@Query("{\"match_phrase\":{\"name\":\"?0\"}}")
	List<SearchDemo> findByNameCustom(String keyword);
}
